package top.goldenyear.porpoise.framework.web.core.generator.config;

import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;

/**
 * 表字段的单独设置
 *
 * @author airhead
 */
@Data
@Accessors(chain = true)
public class ColumnConfig implements Serializable {
  private String tableName = "*";

  /** 字段名称 */
  private String columnName;

  /** 字段是否为主键 */
  private boolean generatedKey = false;

  /** 是否是大字段 */
  private Boolean large = false;

  /** 值转换器 */
  private String conversion;

  /** 是否是逻辑删除字段，一张表中只能存在 1 一个逻辑删除字段 */
  private Boolean logicDelete;

  /** 是否为乐观锁字段 */
  private Boolean version;

  private String versionStrategy;

  private Boolean encryption;
  private String encryptionStrategy;
  private String encryptionQueryLike;

  /** 数据示例 */
  private String example;

  /** 是否是租户 ID */
  private Boolean tenantId = false;

  private Boolean search = true;
  private Boolean searchKeyword = false;
  private String searchOperator;
  private String searchDefValue;
  private Integer searchSortRank;
  private String searchLabel;
  private String searchPlaceholder;
  private String searchRule;
  private String searchRuleTips;
  private String searchSourceType;
  private String searchSourceValue;
  private String searchDataTextAttr;
  private String searchDataValueAttr;
  private String searchDataColAttr;

  private Boolean model = true;
  private String modelDefValue;
  private Boolean form = true;
  private Boolean formCreate = true;
  private Boolean formUpdate = true;
  private Integer formSortRank;
  private String formLabel;
  private String formPlaceholder;
  private String formRule;
  private String formRuleTips;
  private String formElement;
  private String formSourceType;
  private String formSourceValue;
  private String formDataTextAttr;
  private String formDataValueAttr;
  private String formDataColAttr;

  private Boolean result = true;
  private Integer resultWidth;
  private Integer resultMinWidth;
  private Integer resultMaxWidth;
  private Integer resultSortRank;
  private String resultLabel;
  private Boolean resultTranslate;
  private String resultTranslateMethod;
  private String resultTranslateValue;
  private String resultTranslateNewLabel;

  /** 导入导出 */
  private Boolean enableImport = false;
  private Boolean enableExport = false;

  /** 唯一性校验 */
  private Boolean validateUnique = false;

  public static ColumnConfig of() {
    return new ColumnConfig();
  }
}
